package com.sjk.pojo;

import java.io.Serializable;

/**
 * @author lohhhha
 * 2023/5/17
 */

public class Result implements Serializable {
    private Integer code;
    private String msg;
    private Object data;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result ok(Object data) {
        return new Result(Code.SUCCESS, "success", data);
    }

    public static Result error(String msg) {
        return new Result(Code.FAIL, msg, null);
    }
}
